//
//  LoginPwView.m
//  LifeBox
//
//  Created by Lucky on 2019/11/13.
//  Copyright © 2019 Lucky. All rights reserved.
//

#import "LoginPwView.h"

@implementation LoginPwView

#pragma mark - 初始化
- (instancetype)init {
    self = [super init];
    if (self) {
        [self configUI];
        
    }
    return self;
}

#pragma mark - 创建UI
- (void)configUI {
    
    [self ug_radius:KAutoAcale(4)];
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.lineView];
    [self addSubview:self.phoneTF];
    [self addSubview:self.passwTF];
}
-(UIView *)lineView{
    if (!_lineView) {
        _lineView = [UIView new];
        _lineView.backgroundColor = COLOR_EE;
    }
    return _lineView;;
}

-(UGTextField *)phoneTF{
    if (!_phoneTF) {
        _phoneTF = [UGTextField new];
        _phoneTF.ug_maximumLimit = 11;
        _phoneTF.inputType = InputTypeNumber;
        _phoneTF.offset = KPAND_MIN;
        _phoneTF.borderStyle = UITextBorderStyleNone;
        _phoneTF.clearButtonMode = UITextFieldViewModeWhileEditing;
        _phoneTF.font = FONT_SYS16;
        _phoneTF.placeholder = @"请输入手机号";
    }
    return _phoneTF;
}

-(UGTextField *)passwTF{
    if (!_passwTF) {
        _passwTF = [UGTextField new];
        _passwTF.ug_maximumLimit = KPASSWORDLENGTH;
        _passwTF.inputType = InputTypeText;
        _passwTF.offset = KPAND_MIN;
        _passwTF.borderStyle = UITextBorderStyleNone;
        _passwTF.clearButtonMode = UITextFieldViewModeWhileEditing;
        _passwTF.font = FONT_SYS16;
        _passwTF.placeholder = @"请输入登录密码";
        _passwTF.secureTextEntry = YES;
    }
    return _passwTF;
}


-(void)layoutSubviews{
    [super layoutSubviews];
    
    [_phoneTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top);
        make.left.mas_equalTo(KAutoAcale(5));
        make.right.mas_equalTo(-KAutoAcale(5));
        make.bottom.mas_equalTo(self.lineView);
    }];
    
    [_passwTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.mas_bottom);
        make.left.mas_equalTo(KAutoAcale(5));
        make.right.mas_equalTo(-KAutoAcale(5));
        make.top.mas_equalTo(self.lineView);
    }];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
}


@end
